import Vue from 'vue'
// 引入VueRouter
import VueRouter from 'vue-router'
// 引入组件
import About from '@/pages/About.vue'
import Home from '@/pages/Home.vue'
import News from '@/pages/News.vue'
import Message from '@/pages/Message.vue'

// 使用插件
Vue.use(VueRouter)

// 创建并导出一个路由器
export default new VueRouter({
  mode:'history',
  // routes中配置的是一个一个的路由规则
  routes: [
    { 
      name:'guanyu',
      path: '/about', 
      component: About 
    },
    { 
      name:'zhuye',
      path: '/home', 
      component: Home,
      children:[
        {
          name:'xinwen',
          path:'news',
          component:News
        },
        {
          name:'xinxi',
          path:'message',
          component:Message
        }
      ]
    },
  ]
})